package com.ym.medical.domain.param;

import com.ym.common.annotations.CustomConstraint;
import com.ym.common.constant.BeanCovert;
import com.ym.base.enums.FlagEnum;
import com.ym.medical.domain.entity.AppVersionEntity;
import com.ym.medical.enums.DeviceTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.Date;

import static com.ym.common.constant.ValidRule.Add;
import static com.ym.common.constant.ValidRule.Update;

/**
 * APP版本变更记录对象 app_version
 *
 * @author ym
 * @date 2020-08-20
 */
@ApiModel("APP版本变更记录-修改")
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public class AppVersionUpdateParam extends BeanCovert<AppVersionEntity> {

	@ApiModelProperty("主键")
	@NotNull(message = "主键不能为空", groups = {Add.class, Update.class})
	private Integer id;

	@ApiModelProperty("01安卓02苹果")
	@NotNull(message = "01安卓02苹果不能为空", groups = {Add.class, Update.class})
	@CustomConstraint(DeviceTypeEnum.class)
	private Integer terminalType;

	@ApiModelProperty("00不启用01启用")
	@NotEmpty(message = "00不启用01启用不能为空", groups = {Add.class, Update.class})
	@CustomConstraint(FlagEnum.class)
	@Size(max = 2, message = "00不启用01启用长度超过{max}", groups = {Add.class, Update.class})
	private String enabled;

	@ApiModelProperty("版本号，x.y.z")
	@NotEmpty(message = "版本号，x.y.z不能为空", groups = {Add.class, Update.class})
	@Size(max = 20, message = "版本号，x.y.z长度超过{max}", groups = {Add.class, Update.class})
	private String version;

	@ApiModelProperty("更新内容")
	@Size(max = 500, message = "更新内容长度超过{max}", groups = {Add.class, Update.class})
	private String remark;

	@ApiModelProperty("00不强制01强制")
	@NotEmpty(message = "00不强制01强制不能为空", groups = {Add.class, Update.class})
	@CustomConstraint(FlagEnum.class)
	@Size(max = 2, message = "00不强制01强制长度超过{max}", groups = {Add.class, Update.class})
	private String forcedUpdate;

	@ApiModelProperty("生效时间")
	@NotNull(message = "生效时间不能为空", groups = {Add.class, Update.class})
	private Date startTime;

}
